Vue.component('Add', {
	template: `
		<el-dialog title="添加" width="600px" class="icon-dialog" :visible.sync="show" @open="open" :before-close="closeForm" append-to-body>
			<el-form :size="size" ref="form" :model="form" :rules="rules" :label-width=" ismobile()?'90px':'16%'">
				<el-row >
					<el-col :span="24">
						<el-form-item label="关联资源id" prop="related_id">
							<el-input  v-model="form.related_id" autoComplete="off" clearable  placeholder="请输入关联资源id"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="AI手机号录入时间" prop="ai_mobile_time">
							<el-input  v-model="form.ai_mobile_time" autoComplete="off" clearable  placeholder="请输入AI手机号录入时间"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="高德AI_手机号" prop="gd_ai_mobile">
							<el-input  v-model="form.gd_ai_mobile" autoComplete="off" clearable  placeholder="请输入高德AI_手机号"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="百度AI_手机号" prop="bd_ai_mobile">
							<el-input  v-model="form.bd_ai_mobile" autoComplete="off" clearable  placeholder="请输入百度AI_手机号"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="高德接口搜索" prop="gd_interface_search">
							<el-radio-group v-model="form.gd_interface_search">
								<el-radio :label="1">无门脸+主分类+市-区-详细地址</el-radio>
								<el-radio :label="2">无门脸+子分类+市-区-详细地址</el-radio>
								<el-radio :label="3">不成功</el-radio>
								<el-radio :label="0">未调佣</el-radio>
								<el-radio :label="4">1条门脸+主分类+市-区-详细地址-图文</el-radio>
								<el-radio :label="5">1条门脸+子分类+市-区-详细地址-图文</el-radio>
							</el-radio-group>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="高德接口列表过滤" prop="gd_interface_list_filter">
							<el-radio-group v-model="form.gd_interface_list_filter">
								<el-radio :label="1">图文</el-radio>
								<el-radio :label="2">图文+地址</el-radio>
								<el-radio :label="3">图文+市+区</el-radio>
								<el-radio :label="4">图文+市+区+街道</el-radio>
								<el-radio :label="6">图文+市+区+街道+地址</el-radio>
								<el-radio :label="5">图文+市+区+地址</el-radio>
								<el-radio :label="7">不成功</el-radio>
								<el-radio :label="0">未调佣</el-radio>
							</el-radio-group>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="高德标签" prop="gd_tag">
							<el-input  v-model="form.gd_tag" autoComplete="off" clearable  placeholder="请输入高德标签"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="百度地图接口" prop="bd_interface_search">
							<el-radio-group v-model="form.bd_interface_search">
								<el-radio :label="1">市+区+街道+地址+图文</el-radio>
								<el-radio :label="2">市+区+街道+图文</el-radio>
								<el-radio :label="3">不成功</el-radio>
								<el-radio :label="0">未调佣</el-radio>
							</el-radio-group>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="百度地图列表过滤" prop="bd_interface_list_filter">
							<el-radio-group v-model="form.bd_interface_list_filter">
								<el-radio :label="1">图文</el-radio>
								<el-radio :label="2">图文+市+区</el-radio>
								<el-radio :label="3">图文+地址</el-radio>
								<el-radio :label="4">图文+市+区+街道</el-radio>
								<el-radio :label="5">图文+市+区+地址</el-radio>
								<el-radio :label="6">图文+市+区+街道+地址</el-radio>
								<el-radio :label="7">不成功</el-radio>
								<el-radio :label="0">未调佣</el-radio>
							</el-radio-group>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="百度标签" prop="bd_tag">
							<el-input  v-model="form.bd_tag" autoComplete="off" clearable  placeholder="请输入百度标签"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="门脸识别" prop="facade">
							<el-radio-group v-model="form.facade">
								<el-radio :label="1">无门脸数据</el-radio>
								<el-radio :label="2">单条门脸数据</el-radio>
								<el-radio :label="0">未调佣</el-radio>
								<el-radio :label="3">多条门脸数据</el-radio>
							</el-radio-group>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="百度通用文字识别" prop="bd_general_text">
							<el-radio-group v-model="form.bd_general_text">
								<el-radio :label="1">成功</el-radio>
								<el-radio :label="2">不成功</el-radio>
								<el-radio :label="0">未调佣</el-radio>
							</el-radio-group>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="腾讯通用文字识别" prop="tx_general_text">
							<el-radio-group v-model="form.tx_general_text">
								<el-radio :label="1">成功</el-radio>
								<el-radio :label="2">不成功</el-radio>
								<el-radio :label="0">未调佣</el-radio>
							</el-radio-group>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="AI电话扫描状态" prop="ai_mobile_status">
							<el-radio-group v-model="form.ai_mobile_status">
								<el-radio :label="1">扫描成功</el-radio>
								<el-radio :label="0">未扫描</el-radio>
								<el-radio :label="2">扫描失败</el-radio>
							</el-radio-group>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="地图接口状态" prop="map_status">
							<el-checkbox-group v-model="form.map_status">
								<el-checkbox key="0" label="0">未返回</el-checkbox>
								<el-checkbox key="1" label="1">百度地图成功</el-checkbox>
								<el-checkbox key="2" label="2">高德地图成功</el-checkbox>
								<el-checkbox key="3" label="3">不成功</el-checkbox>
							</el-checkbox-group>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="店铺图片1" prop="shop_img_1">
							<Upload v-if="show" size="small"  upload_type="1"   rename="2" file_type="image"  :image.sync="form.shop_img_1"></Upload>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="店铺图片2" prop="shop_img_2">
							<Upload v-if="show" size="small"  upload_type="1"   rename="2" file_type="image"  :image.sync="form.shop_img_2"></Upload>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row >
					<el-col :span="24">
						<el-form-item label="手机号数量状态" prop="mobile_num_status">
							<el-radio-group v-model="form.mobile_num_status">
								<el-radio :label="0">失败</el-radio>
								<el-radio :label="1">单手机号</el-radio>
								<el-radio :label="2">多手机号</el-radio>
								<el-radio :label="3">超出3个手机号</el-radio>
							</el-radio-group>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button :size="size" :loading="loading" type="primary" @click="submit" >
					<span v-if="!loading">确 定</span>
					<span v-else>提 交 中...</span>
				</el-button>
				<el-button :size="size" @click="closeForm">取 消</el-button>
			</div>
		</el-dialog>
	`
	,
	components:{
	},
	props: {
		show: {
			type: Boolean,
			default: false
		},
		size: {
			type: String,
			default: 'small'
		},
	},
	data(){
		return {
			form: {
				related_id:'',
				ai_mobile_time:'',
				gd_ai_mobile:'',
				bd_ai_mobile:'',
				gd_interface_search:0,
				gd_interface_list_filter:0,
				gd_tag:'',
				bd_interface_search:0,
				bd_interface_list_filter:0,
				bd_tag:'',
				facade:0,
				bd_general_text:0,
				tx_general_text:0,
				ai_mobile_status:0,
				map_status:[],
				shop_img_1:'',
				shop_img_2:'',
				mobile_num_status:0,
			},
			loading:false,
			rules: {
			}
		}
	},
	methods: {
		open(){
		},
		submit(){
			this.$refs['form'].validate(valid => {
				if(valid) {
					this.loading = true
					axios.post(base_url + '/AiMobileCheck/add',this.form).then(res => {
						if(res.data.status == 200){
							this.$message({message: res.data.msg, type: 'success'})
							this.$emit('refesh_list')
							this.closeForm()
						}else{
							this.loading = false
							this.$message.error(res.data.msg)
						}
					}).catch(()=>{
						this.loading = false
					})
				}
			})
		},
		closeForm(){
			this.$emit('update:show', false)
			this.loading = false
			if (this.$refs['form']!==undefined) {
				this.$refs['form'].resetFields()
			}
		},
	}
})
